'user strict';
import React, {
    Component
} from 'react';
import {
    hashHistory
} from 'react-router'

import imgBack from '../../Img/buy/back2.png'

export default class Header extends Component {
    constructor(props) {
        super(props)
    }
    goBlack() {
        if (this.props.addFn) {
            this.props.addFn();
            return;
        }
        if (this.props.toLink) {
            hashHistory.push(this.props.toLink)
            return;
        }
        hashHistory.goBack(-1);
    }
    render() {
        const {
            hideBack
        } = this.props
        return (
            <header className='header text-els' id={hideBack== 'true'?'headerstatic':null}>
                <a className='h-back' onClick={this.goBlack.bind(this)}>{hideBack== 'true'?'':<img src={imgBack}/>}</a>
                {this.props.title}
            </header>
        )
    }
}
